package Concurrency.basic;

/**
 * 用synchronized修饰代码块， 其实是锁定了一个object对象
 */

public class SynchronizedBlockCounter {
    private int count;

    public void incr() {
        synchronized (this) {
            count++;
        }
    }

    public int getCount() {
        synchronized (this) {
            return count;
        }
    }
}
